package model

import "encoding/json"

type UserUpgradeCreateRequest struct {
	Id              int64           `json:"id"`
	UserId          int64           `json:"user_id"`
	UserName        string          `json:"user_name"`
	UserPhone       string          `json:"user_phone"`
	PlanId          int64           `json:"plan_id"`
	PlanName        string          `json:"plan_name"`
	StrategyId      int64           `json:"strategy_id"`
	UpgradeType     int             `json:"upgrade_type"`
	EbikeId         int64           `json:"ebike_id"`
	EbikeName       string          `json:"ebike_name"`
	EbikeSnCode     string          `json:"ebike_sn_code"`
	EbikeTypeId     int64           `json:"ebike_type_id"`
	EbikeTypeName   string          `json:"ebike_type_name"`
	Detail          json.RawMessage `json:"detail"`
	Progress        float32         `json:"progress"`
	Status          int             `json:"status"`
	StatusDetail    json.RawMessage `json:"status_detail"`
	UpgradingStatus int             `json:"upgrading_status"`
	FailureReason   string          `json:"failure_reason"`
	RetryCount      int             `json:"retry_count"`
	CreatedAt       int64           `json:"created_at"`
	UpdatedAt       int64           `json:"updated_at"`
}
type UserUpgradeUpdateRequest struct {
	Id                *int64          `json:"id"`
	Ids               []int64         `json:"ids"`
	UserId            *int64          `json:"user_id"`
	UserName          *string         `json:"user_name"`
	PlanId            *int64          `json:"plan_id"`
	PlanName          *string         `json:"plan_name"`
	EbikeId           *int64          `json:"ebike_id"`
	EbikeName         *string         `json:"ebike_name"`
	EbikeSnCode       *string         `json:"ebike_sn_code"`
	EbikeTypeId       *int64          `json:"ebike_type_id"`
	EbikeTypeName     *string         `json:"ebike_type_name"`
	Detail            json.RawMessage `json:"detail"`
	Progress          *float32        `json:"progress"`
	Status            *int            `json:"status"`
	StatusDetail      json.RawMessage `json:"status_detail"`
	FailureReason     *string         `json:"failure_reason"`
	FailureLatestTime *int64          `json:"failure_latest_time"`
	RetryCount        *int            `json:"retry_count"`
	CreatedAt         *int64          `json:"created_at"`
	UpdatedAt         *int64          `json:"updated_at"`
}

type UserUpgradeListRequest struct {
	Id              *int64          `json:"id"`
	Ids             []int64         `json:"ids"`
	UserId          *int64          `json:"user_id"`
	UserIds         []int64         `json:"user_ids"`
	UserName        *string         `json:"user_name"`
	PlanId          *int64          `json:"plan_id"`
	PlanIds         []int64         `json:"plan_ids"`
	PlanName        *string         `json:"plan_name"`
	UpgradeType     int             `json:"upgrade_type"`
	UpgradeTypes    []int           `json:"upgrade_types"`
	EbikeId         *int64          `json:"ebike_id"`
	EbikeIds        []int64         `json:"ebike_ids"`
	EbikeName       *string         `json:"ebike_name"`
	EbikeSnCode     *string         `json:"ebike_sn_code"`
	EbikeSnCodes    []string        `json:"ebike_sn_codes"`
	EbikeTypeId     *int64          `json:"ebike_type_id"`
	EbikeTypeIds    []int64         `json:"ebike_type_ids"`
	EbikeTypeName   *string         `json:"ebike_type_name"`
	Detail          json.RawMessage `json:"detail"`
	Progress        *float32        `json:"progress"`
	Status          *int            `json:"status"`
	Statuses        []int           `json:"statuses"`
	UpgradingStatus *int            `json:"upgrading_status"`
	FailureReason   *string         `json:"failure_reason"`
	RetryCount      *int            `json:"retry_count"`
	CreatedAt       *int64          `json:"created_at"`
	UpdatedAt       *int64          `json:"updated_at"`
	Index           int             `json:"index"`
	Size            int             `json:"size"`
}
type UserUpgradeListResponse struct {
	Total int                `json:"total"`
	List  []*UserUpgradeInfo `json:"list"`
}
type UserUpgradeInfoRequest struct {
	Id int64 `json:"id"`
}

type GetLastUpgradingRecordRequest struct {
	PlanId int64 `json:"plan_id"`
}

type GetLastUpgradingRecordResponse struct {
	List []GetLastUpgradingRecordItem `json:"list"`
}

type GetLastUpgradingRecordItem struct {
	EbikeId int64 `json:"ebike_id" gorm:"column:ebike_id"`
	Id      int64 `json:"id" gorm:"column:id"`
}

type UserUpgradeStatisticsRequest struct {
	PlanId  int64   `json:"plan_id"`
	PlanIds []int64 `json:"plan_ids"`
}

type UserUpgradeStatisticsResponse struct {
	List []UserUpgradeStatisticsItem `json:"list"`
}

type UserUpgradeStatisticsItem struct {
	PlanId         int64 `json:"plan_id" gorm:"column:plan_id"`
	AllTotal       int   `json:"alltotal" gorm:"column:alltotal"`
	PrepareTotal   int   `json:"prepareTotal" gorm:"column:preparetotal"`
	UpgradingTotal int   `json:"upgradingTotal" gorm:"column:upgradingtotal"`
	SuccessTotal   int   `json:"successTotal" gorm:"column:successtotal"`
	FailedTotal    int   `json:"failTotal" gorm:"column:failtotal"`
	CancelTotal    int   `json:"cancelTotal" gorm:"column:canceltotal"`
}

type UserUpgradeRetryRequest struct {
	EbikeIds []int64  `json:"ebike_ids"`
	SnCode   []string `json:"sn_codes"`
	Ids      []int64  `json:"ids"`
	PlanIds  []int64  `json:"plan_ids"`
}

type UserUpgradeInfo struct {
	Id                int64           `json:"id"`
	UserId            int64           `json:"user_id"`
	UserName          string          `json:"user_name"`
	UserPhone         string          `json:"user_phone"`
	PlanId            int64           `json:"plan_id"`
	PlanName          string          `json:"plan_name"`
	EbikeId           int64           `json:"ebike_id"`
	EbikeName         string          `json:"ebike_name"`
	EbikeSnCode       string          `json:"ebike_sn_code"`
	EbikeTypeId       int64           `json:"ebike_type_id"`
	EbikeTypeName     string          `json:"ebike_type_name"`
	UpgradeStrategyID int64           `json:"upgrade_strategy_id"`
	Detail            json.RawMessage `json:"detail"`
	Progress          float32         `json:"progress"`
	Status            int             `json:"status"`
	StatusDetail      json.RawMessage `json:"status_detail"`
	UpgradingStatus   int             `json:"upgrading_status"`
	FailureReason     string          `json:"failure_reason"`
	FailureLatestTime int64           `json:"failure_latest_time"`
	RetryCount        int             `json:"retry_count"`
	CreatedAt         int64           `json:"created_at"`
	UpdatedAt         int64           `json:"updated_at"`
}
type UserUpgradeDeleteRequest struct {
	Id int64 `json:"id"`
}

type UserUpgradeTerminalRequest struct {
	PlanId int64 `json:"plan_id"`
}

type GetUpgradeDevicesRequest struct {
	PlanId int64 `json:"plan_id"`
}
